[Smalltalk] Store List of Instruction

Posted by Luciano Lorenti on Stack Overflow See other posts from Stack Overflow or by Luciano Lorenti
Published on 2010-03-27T16:42:48Z Indexed on 2010/03/29 23:13 UTC
Read the original article Hit count: 420

Hi all, I have a design Problem. i have a Drawer class wich invokes a serie of methods of a kind-of-brush class and i have a predefined shapes which i want to draw. Each shape uses a list of instance methods from the drawer. I can have more than 1 brush object.
I want to add custom shapes on runtime in the drawer instance, especifying the list of methods of the new shape.
i've created a class method for every predefined shape that returns a BlockClosure with the instruccions. Obviously i have to give to each BlockClosure the brush object as parameter. I imagine a collection with all the BlockClosures in each instance of the Drawer Class. Maybe i can inherit a SequenceableCollection and make a instruccion collection. Each element of the collection it's a instruction and i give the brush object when i instance this new collection. I really don't know the best way to store these steps.
(Maybe a shared variable?)

© Stack Overflow or respective owner

Related posts about smalltalk

Related posts about object-oriented-design